//搜索地址和经纬度
function search2(t){
var formData=[];
console.log($('[name="address"]').val());

formData['keywords']=$('[name="address"]').val();
$.ajax({
url:"https://addr.vmall.com/data/searchByKeywords.json",
type:'GET',
data:{'keywords':formData['keywords']},
dataType:'jsonp',
success:function(res){
if (res.success==false){
layer.msg(res.msg, {shade: 0.5, time: 1000,icon: 2});
}
if (res.data.length<1){
return false
}
var html='';
$.each(res.data,function ($k,$v) {
html+=' <li>\n' +
    '      <span>'+$v.name+'</span><br>\n' +
    '      <span>'+$v.provinceName+$v.cityName+$v.distinctName+'</span>\n' +
    '      <button type="button" class="am-btn am-btn-danger am-btn-xs" onclick="select_site(\''+$v.provinceName+$v.cityName+$v.distinctName+$v.name+'\',\''+$v.location+'\')">选择</button>\n' +

    '  </li>';

$(".diz_window ul").html(html)
})
}
});
}
//选择地址
function select_site($dz,$location) {
console.log($location);
console.log($dz);

$(".diz_window ul").html('');
var arr = $location.split(',');
$('[name="address"]').val($dz);
$('[name="longitude"]').val(arr[0]);
$('[name="latitude"]').val(arr[1]);

}